from django.urls import include, path, re_path
from rest_framework.routers import SimpleRouter, DefaultRouter
from workorder import views
from workorder import tests

# 自动生成路由方法, 必须使用视图集
router = DefaultRouter()   # 有根路由
router.register(r'flowconf', views.FlowConfViewSet)  # workorder/flowconf/
router.register(r'approveconf', views.ApproveConfViewSet)  # workorder/approveconf/
router.register(r'workorder', views.WorkOrderViewSet)  # workorder/approveconf/
router.register(r'suborder', views.SubOrderViewSet)  # workorder/suborder/


urlpatterns = [
    path('approves/', views.ApprovesView.as_view()),
    path('workorder/instance/',views.FlowConfInstanceView.as_view()),
    path('suborder/list/',views.SubOrderListView.as_view()),
    path('workorder/list/',views.WorkOrderView.as_view()),
    path('workorder/approve/',views.WorkApproveView.as_view()),
]

urlpatterns += router.urls  # 模块地址
